﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace Clmp.Data.DBEntity2
{
    public interface IDataContainer : IDisposable
    {
        IDataContainer OpenConnection();
        IDataContainer CloseConnection();
        IDbTransaction BeginTransaction();

        int Insert<T>(T entity) where T : Entity;
        int Update<T>(T entity) where T : Entity;
        int Delete<T>(int id) where T : Entity;
        T GetOne<T>(int id) where T : Entity;
        List<T> Query<T>(string sqlStr, params object[] pars) where T : Entity;

        int ExecuteNonQuery(string sqlStr, params object[] pars);
        object ExecuteScalar(string sqlStr, params object[] pars);
        DataSet GetDateSet(string sqlStr, params object[] pars);
        IDataReader GetDataReader(string sqlStr, params object[] pars);
    }
}
